package org.apache.solr.ocean.replication;

import java.net.URL;

import org.apache.solr.ocean.util.Timeout;

public abstract class Cell {
  public abstract String voteOnMaster(Timeout timeout);
  public abstract String getAgreedMaster(Timeout timeout, boolean useCache);
  public abstract boolean isMaster(String nodeId);
  public abstract void notifySlaveNotInSync(String masterNodeId, String nodeIdLease);  
  public abstract void notifyMasterFailure(String masterNodeId);
  public abstract void registerListener(Listener cellListener);
  
  /**
   * Make http call to obtain node info
   */
  public NodeInfo getNodeInfo(String nodeId, Timeout timeout) {
    
  }
  
  public static class Node {
    public String id;
    public URL url;
    
    public Node(String id, URL url) {
      this.id = id;
      this.url = url;
    }
  }
  
  public static interface Listener {
    public void newMaster(NodeInfo newMaster);
  }
}
